package org.zecontech.plantvszombie.datagen;

import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.minecraft.client.data.models.BlockModelGenerators;
import net.minecraft.client.data.models.ItemModelGenerators;
import net.minecraft.client.data.models.model.ModelTemplates;
import net.minecraft.core.registries.BuiltInRegistries;
import org.zecontech.plantvszombie.PlantVsZombieMod;
import org.zecontech.plantvszombie.util.Helpers;

// 模组材质模型json自动生成器
public class ModModelGenerator extends FabricModelProvider {

    public ModModelGenerator(FabricDataOutput output) {
        super(output);
    }

    /**
     * 生成方块模型
     * @param generators 生成器
     */
    @Override
    public void generateBlockStateModels(BlockModelGenerators generators) {

    }

    /**
     * 生成物品模型
     * @param generators 生成器
     */
    @Override
    public void generateItemModels(ItemModelGenerators generators) {
        BuiltInRegistries.ITEM.forEach(item -> {
            if (BuiltInRegistries.ITEM.getKey(item).getNamespace().equals(PlantVsZombieMod.MOD_ID)) {
                generators.generateFlatItem(item, ModelTemplates.FLAT_HANDHELD_ITEM);
            }
        });
    }
}
